<?php
/**
 * 协程redis
 */

/*$redis = new \Swoole\Coroutine\Redis();

$redis->connect("127.0.0.1",6379);
$redis->get('fengqin');*/

$http_server = new swoole_http_server('0.0.0.0',6064);

$http_server->on("request",function($request,$response){
    //获取redis里边 key 的内容 ，然后输出到浏览器
    $redis = new \Swoole\Coroutine\Redis();
    $redis->connect("127.0.0.1",6379);
    $value = $redis->get($request->get['a']);
//    echo 123;die();
    $response->header("Content-Type","text/plain");
    $response->end($value);
});
$http_server->start();






